import time
import os
from  multiprocessing import Process

'''
'''

def task1(name):
    while  True:
        time.sleep(1)
        print('''{} 子进程id:{},父进程id:{} 进行中。。。。'''.format(name,os.getpid(),os.getppid()))

def task2(name):
    while True:
        time.sleep(1)
        print('''{} 子进程id:{},父进程id:{} 进行中。。。。'''.format(name,os.getpid(),os.getppid()))

if __name__ == '__main__':
    i=0
    p1=Process(target=task1,args=('name1',))
    p1.start()
    p2=Process(target=task2,args=('name2',),name='process1')
    p2.start()
    while True:
        i += 1
        time.sleep(0.2)
        if i==100:
            p1.terminate()
            p2.terminate()
            break
        else:
            print(i)
    print('end up main process!',p2.name)

    
